<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #text{
            width:215px ;
            height: 200px;
            border: 1px solid gray;
            
        }
    </style>
</head>
<body>
    <div id="text"></div>
    <input type="text" id="word">
    <input type="button" value="发送" id="button">
    <script>
        var word =document.getElementById('word')
        button.onclick = function(){
            var str = document.getElementById('word').value
            text.innerHTML+=str+'<br/>'
            word.value=''
        }
        word.onkeydown =function(event){
            var e =event||window.event
            if(e.ctrlKey==false && e.altKey==false && e.shiftKey==false&&e.keyCode==13){
                var str = document.getElementById('word').value
                text.innerHTML+=str+'<br/>'
                word.value=''
            }else if(e.ctrlKey==true &&e.keyCode==13){
                var str = document.getElementById('word').value
                text.innerHTML+=str+'<br/>'
                word.value=''
            }
        }
    </script>
</body>
</html>